
class Object
  
  @@unprocessed ||= []
  @@__once_helper ||= {}

  def self.once &block
    if block_given?
      unless @@__once_helper[self]
        @@__once_helper[self] = true
        @@unprocessed << block
      end
    else
      r = @@unprocessed
      @@unprocessed = []
      r
    end
  end

end
